#ifndef __ANALOG_H__
#define __ANALOG_H__

#include "ch32v_def.h"
#include "PeripheralPins.h"
#include "HardwareTimer.h"

#ifdef __cplusplus
extern "C" {
#endif

// void dac_write_value(PinName pin, uint32_t value, uint8_t do_init);
// void dac_stop(PinName pin);
uint16_t adc_read_value(PinName pin, uint32_t resolution);
void pwm_start(PinName pin, uint32_t clock_freq, uint32_t value, TimerCompareFormat_t resolution);
void pwm_stop(PinName pin);

uint32_t get_pwm_channel(PinName pin);

#ifdef __cplusplus
}
#endif

#endif // __ANALOG_H__